<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>布局技巧03</title>
  <style>
    .outer{
      width: 400px;
      height: 400px;
      background-color: gray;
    /*  行内元素按问罪处理,让inner和img水平居中*/
      text-align: center;
    /*  让inner和img垂直居中*/
      line-height: 400px;
    /*  去除空白页*/
      font-size: 0px;
    }

    .inner{
      background-color: orange;
      font-size: 50px;
      vertical-align: middle;

    }
    .inner2{
      background-color: greenyellow;
      font-size: 30px;
      vertical-align: middle;

    }
    img{
      width: 100px;
      height: 100px;
      border: 5px solid red;
      vertical-align: middle;
    }
  </style>
</head>
<body>
<div class="outer">

  <span class="inner">x出来玩啊</span>
  <span class="inner2">x</span>
  <img src="img.png" alt="">
</div>
</body>
</html>